Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SatlasPretrain: ResNet50/152 and Swin_V2_T Weights #2038

Merged
merged 12 commits into from
Aug 27, 2024

Conversation

yichiac
Copy link
Contributor

@yichiac yichiac commented May 1, 2024

This PR adds SatlasPretrain ResNet50 weights as the Enums.

@piperwolters @favyen2

@github-actions github-actions bot added documentation Improvements or additions to documentation models Models and pretrained weights labels May 1, 2024
Copy link
Collaborator

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to apply all the same changes I requested on #1884

Also, CI passes because we only use fake model weights, but using the real model weights result in test failures:

> pytest -m slow tests/models/test_resnet.py
...
E           RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

@adamjstewart adamjstewart added this to the 0.6.0 milestone May 2, 2024
@github-actions github-actions bot added testing Continuous integration testing transforms Data augmentation transforms labels Aug 20, 2024
@adamjstewart adamjstewart changed the title SatlasPretrain ResNet50 Weights SatlasPretrain: ResNet50/152 and Swin_V2_T Weights Aug 20, 2024
num_channels = weights.meta['in_chans']
out_channels = model.features[0][0].out_channels
# https://github.com/allenai/satlaspretrain_models/blob/main/satlaspretrain_models/models/backbones.py#L27
model.features[0][0] = torch.nn.Conv2d(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was completely broken for MS models until now.

adamjstewart
adamjstewart previously approved these changes Aug 20, 2024
@@ -272,3 +272,54 @@ def apply_transform(
out = rearrange(out, 'b t c h w -> (b t) c h w')

return out


class _Clamp(K.IntensityAugmentationBase2D):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnnv1 is this something Kornia would be interested in? If so I can contribute it when I have a chance.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, not sure why it will be a augmentation. But i think it's fine to add to kornia if have uses for it. Just to make sure, @shijianjian we don't have it, right?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to kornia/kornia#941

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use case is that this comes up commonly in satellite imagery pipelines where images aren't always uint8 and need to be converted to uint8 (0–255) or normalized (0–1) without out-of-bounds data. See SeCo and Satlas for examples where this is used.

@adamjstewart
Copy link
Collaborator

Are there any published performance metrics for all weights? Would love to add these to the weights tables.

Copy link
Collaborator

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will wait a bit more for further review but it sounds like everything is in order now.

@piperwolters
Copy link
Contributor

piperwolters commented Aug 22, 2024

Will wait a bit more for further review but it sounds like everything is in order now.

Looking into if we have performance metrics that could fit into the torchgeo tables. Everything else looks good to me.
Favyen is OOO this week, so could wait for him to have a look as well and 100% confirm band order.

Thank you both so much for making this PR!

@adamjstewart
Copy link
Collaborator

Looking into if we have performance metrics that could fit into the torchgeo tables. Everything else looks good to me.

It doesn't have to be the same benchmark datasets we used, it could be different benchmarks.

Favyen is OOO this week, so could wait for him to have a look as well and 100% confirm band order.

I'm planning on releasing TorchGeo 0.6.0 by the end of this month, so hopefully he can review by Monday.

@adamjstewart
Copy link
Collaborator

Going to merge so we can finalize the release soon. @favyen2 can review later if he has time.

@adamjstewart adamjstewart merged commit a757cf1 into microsoft:main Aug 27, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation models Models and pretrained weights testing Continuous integration testing transforms Data augmentation transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants